<?php

declare(strict_types=1);

namespace app\command;

use app\common\service\ai\AiVideoService;
use app\common\service\ai\AiVoiceService;
use app\common\service\utils\FFmpeg;
use app\common\service\utils\Utils;
use think\console\Command;
use think\console\Input;
use think\console\Output;

/**
 * 定时任务
 */
class MakeVoice extends Command
{
    protected function configure()
    {
        $this->setName('makeVideo:command')->setDescription('生成AI音频');
    }

    protected function execute(Input $input, Output $output)
    {
        $output->writeln("makeVoice:Command: Successful");
        $data = AiVoiceService::getTobeList();
        echo '数量：' . count($data) . PHP_EOL;
        foreach ($data as $k => $v) {
            //修改状态，已生成
            //...todo
            echo '生成音频:' . $v['id'] . PHP_EOL;
            AiVoiceService::update(['id' => $v['id']], ['id'=>$v['id'],'status' => 1,'url'=>'https://aivoice.littlegood.cn/api/uploads/file/满分作文_20240921183118.wav']);
            sleep(1);
        }

    }

}
